package net.aaa.hotel.dao.impl;

import net.aaa.hotel.dao.TChangeRoomDao;
import net.aaa.hotel.entity.TChangeroom;
import net.aaa.hotel.util.BaseDB;
import org.springframework.stereotype.Repository;

@Repository
public class ChangeRoomDaoImpl implements TChangeRoomDao {
    @Override
    public int addChangeRomRecord(TChangeroom changeroom) {
        String sql = "insert into t_changeroom(ruzhuid,time,oldroomid,newroomid) values(?,now(),?,?)";
        return BaseDB.update(sql,changeroom.getRuzhuid(),changeroom.getOldroomid(),changeroom.getNewroomid());
    }

    @Override
    public int getCountByRuZhuId(int ruzhuid) {
        String sql  = "select count(*) a from t_changeroom where ruzhuid=?";
        Object a = BaseDB.queryMap(sql, ruzhuid).get(0).get("a");
        return Integer.parseInt(a+"");
    }
}
